/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package preprocessing;

import weka.filters.supervised.attribute.AttributeSelection;
import weka.core.Instances;
import weka.filters.Filter;

/**
 *
 * @author Winzelric
 */
public class SupervisedAttributeSelection {
  Instances ins;
  
  public SupervisedAttributeSelection(Instances x) {
      ins = x;
  }
  
  public Instances returnInstances (Instances x) {
      String[] options = new String[2];
      options[0] = "-R";                                    // "range"
      options[1] = "1";                                     // first attribute
      AttributeSelection selection = new AttributeSelection();             // new instance of filter
        try {
            selection.setOptions(options);                       // set options
            selection.setInputFormat(x);
            ins = Filter.useFilter(x, selection);
        } catch (Exception ex) {
        }
      return ins;
  }
}
